/* 
 * setjmp.h
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is a part of the clang port package.
 * No warranty is given; refer to the file DISCLAIMER within the package.
 *
 * Declarations supporting setjmp and longjump, a method for avoiding
 * the normal function call return sequence. (Bleah!)
 *
 */

#ifndef _CLANG_PORT_SETJMP_H_
#define _CLANG_PORT_SETJMP_H_

/* All the headers include this file. */
#ifndef __IMPL_CLANG_PORT_API_
#	include <_clang_port.h>
#else
#	include <include/_clang_port.h>
#endif

#ifndef __IMPL_CLANG_PORT_API_
#define _JBLEN 16
#define _JBTYPE int
typedef _JBTYPE jmp_buf[_JBLEN];
#endif /* __IMPL_CLANG_PORT_API_ */


#ifdef __cplusplus
extern "C" {
#endif

#ifndef __IMPL_CLANG_PORT_API_
CLANG_PORT_INLINE int setjmp (void ** buf)
{
	return CLANG_BUILTIN_CALL(setjmp)(buf);
}

// LIBBUILTIN
void longjmp(jmp_buf env, int val);

#endif /* __IMPL_CLANG_PORT_API_ */

#ifdef __cplusplus
}
#endif


#endif	/* Not _CLANG_PORT_SETJMP_H_ */

